#!/bin/bash

echo "----------------"
echo "  $(hostname)"
echo -e "----------------\n"

for x in $(cat /etc/hosts|awk '{print $1}'|grep -v -E "^#|:"|sort|uniq);do
    echo -e "$x\t"
    ssh -o "BatchMode yes" -o ConnectTimeout=5 $x "sh -c \"for c in \\\$(ip addr show up|grep \\\"^[1-9][0-9]*:\\\" |grep -v -E \\\"^.* .* .* mtu .* master \\\" |awk '{print \\\$2}'|grep -v -E \\\"@|^lo|^qbr|^tap|^docker|^virbr|^br-|^fg-|^qg-|^qr-|^ovs-|^vxlan|^flannel|^cni|^vnet\\\" |tr -d \\\":\\\");do sysctl net.ipv4.conf.\\\$c.rp_filter=0; done; sysctl net.ipv4.conf.all.rp_filter=0; sysctl net.ipv4.conf.default.rp_filter=0; sysctl net.ipv4.ip_forward=1; sysctl net.ipv4.tcp_tw_recycle=0; sysctl net.bridge.bridge-nf-call-iptables=1; sysctl net.bridge.bridge-nf-call-ip6tables=1; \""
    echo
done
